Skip Headers

Oracle® Objects for OLE C++ Class Library Developer's Guide 10g Release 2 (10.2) Part Number B14308-01 |
Home | Book List | Contents | Index | Master Index | Feedback

# RemoveFromPool Method

Applies To

ODatabase

Description

This method removes the database from the pool.

Usage

oresult RemoveFromPool(void) const

Arguments

none
Remarks

This method applies only to those ODatabase objects which are retrieved from the pool using a ODatabase::GetDatabaseFromPool. This method is particularly useful for removing ODatabase objects from the pool whose connections are no longer valid.

Return Value

An oresult indicating whether the operation succeeded (OSUCCESS) or not (OFAILURE).

Example

This example creates a pool of 2 connections with a maximum of 10 connections, and then gets a database from the pool.

OSession osess;

osess.Open();

osess.CreateDatabasePool(2,10,200, "Exampledb", "scott", "tiger",

ODATABASE_DEFAULT);

odb = sess1.GetDatabaseFromPool(5000); //Get database from pool

oresult ores= odb.ExecuteSQL("drop table dontwantit");

if (ores == OFAILURE )

{

if (odb.ServerErrorNumber != 0) //there was a server error

odb.RemoveFromPool();

odb = sess1.GetDatabaseFromPool(5000); //Get database

}